import { defineStore } from 'pinia';
import { reactive } from 'vue';
import { RoutesListState } from './interface';
/**
 * 路由列表
 * @methods setRoutesList 设置路由数据
 * @methods setColumnsMenuHover 设置分栏布局菜单鼠标移入 boolean
 * @methods setColumnsNavHover 设置分栏布局最左侧导航鼠标移入 boolean
 */
export const useRoutesList = defineStore('routesList', () => {
	let routesList = reactive<RoutesListState>({
		routesList: [],
		isColumnsMenuHover: false,
		isColumnsNavHover: false,
	})


	return {
		routesList, getRoutesList, setRoutesList, setColumnsMenuHover, setColumnsNavHover
	}

	function getRoutesList() {
		return routesList.routesList || []
	}

	function setRoutesList(data: Array<any>) {
		routesList.routesList = data;
	}
	function setColumnsMenuHover(bool: Boolean) {
		routesList.isColumnsMenuHover = bool;
	}
	function setColumnsNavHover(bool: Boolean) {
		routesList.isColumnsNavHover = bool;
	}
})
